home *** CD-ROM | disk | FTP | other *** search
- // Fireworks Css Layer output.
- // Version 2.0 25JAN99
-
-
- // Write general comments for copying and pasting Fireworks-generated code into existing HTML documents.
- WRITE_HTML("<!-- To put this html into an existing HTML document, you must copy and \n");
- WRITE_HTML("paste code from within the body tag of this document into the body tag \n");
- WRITE_HTML("of the target document. -->\n");
- WRITE_HTML("\n")
-
-
- WRITE_HTML("<html>\n");
- WRITE_HTML("\n")
-
- WRITE_HTML("<head>\n");
- WRITE_HTML("\n")
-
- // Use Base Name from export dialog as document title.
- WRITE_HTML("<title>", exportDoc.filename, "</title>\n");
- WRITE_HTML("\n")
-
- // Write Meta tags.
- WRITE_HTML("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\">\n");
- WRITE_HTML("<meta name=\"description\" content=\"Fireworks CSS Layer\">\n");
- WRITE_HTML("\n")
-
- // Write HTML target and date created.
- var d = new Date();
- WRITE_HTML("<!-- Fireworks 2.0 Css Layers. \n Created ", d, " -->\n");
- WRITE_HTML("\n")
-
- // Close head tag.
- WRITE_HTML("</head>\n");
- WRITE_HTML("\n")
-
- // Function LayerName determines the name of the current layer.
- function LayerName(str) {
- var newName = str.toString().replace(/_/g, "");
- newName = newName.replace(/ /g, "");
- if (newName == "") newName = "EmptyName";
- if (!newName) newName = "EmptyName";
- if (newName.search(/\d/) == 0) {
- newName = "L"+newName;
- }
- return(newName);
- }
-
- // Function CellName determines the name for the image in a particular table cell.
- // Cellname is based off of the slice name if one was specified. Otherwise the
- // Base file name from the export dialog is used.
- function CellName(str, row, col) {
- var cellName = str.toString();
- // remove illegal characters
- cellName = cellName.replace(/\W/g, "");
- // if it starts with a number, add N to the front.
- if (cellName == "") {
- cellName = "N" + exportDoc.imagename + "_" + (row+1) + "_" + (col+1);
- // remove illegal characters
- cellName = cellName.replace(/\W/g, "");
- }
- if (cellName.search(/\d/) == 0) {
- cellName = "N"+cellName;
- }
- return(cellName);
- }
-
- // Begin body tag. Set background color to Fireworks document canvas color.
- WRITE_HTML("<body bgcolor=\"#", exportDoc.backgroundColor, "\">\n");
- WRITE_HTML("\n")
-
- // Write comment for start of code copy/paste section.
- WRITE_HTML("<! ------------------------ BEGIN COPYING THE CODE HERE -------------------------->\n");
- WRITE_HTML("\n");
-
- // Analyze each slice and determine whether or not an image file is exported.
- var curCol;
- var curRow;
- var curSlice;
- var curZ = 1;
- for (curRow = 0; curRow < slices.numRows; curRow++) {
- for (curCol = 0; curCol < slices.numColumns; curCol++) {
- curSlice = slices[curRow][curCol];
-
- if (curSlice.skipCell) continue;
-
- if (!curSlice.hasImage) {
- // no image
- continue;
- }
-
- if (curSlice.isUndefined && slices.doSkipUndefined) {
- curSlice.setFrameFileName(0, "");
- continue;
- }
- if (curSlice.isUndefined) {
- curSlice.setFrameFileName(0, "");
- continue;
- }
-
- if (curSlice.hasImage) {
-
- // Determine the current slice's file name and name the layer accordingly.
- var imageName = curSlice.getFrameFileName(0);
- if (imageName == "") continue;
- var layerName = LayerName(imageName);
- var cellName = CellName(imageName, curRow, curCol);
-
- // Write the div tag to specify layer. Obtain and enter height, width and
- // positioning information.
- // Ex: <div id="Layer1" style="position:absolute; left:35px; top:34px; width:115px; height:96px; z-index:1">
- WRITE_HTML("<div id=\"", layerName, "\" style=\"position:absolute; ");
- WRITE_HTML("left:", curSlice.left, "px; top:", curSlice.top, "px;")
- WRITE_HTML("width:", curSlice.width, "px; height:", curSlice.height, "px;");
- WRITE_HTML("z-index:", curZ, "; visibility:visible\">");
-
- // Place image.
- // Ex: <img name="N_03_02" src="File_03_02.gif" width="79" height="71" border="0"
- WRITE_HTML("<img name=\"", cellName, "\" src=\"",
- slices.imagesDirPath, imageName, curSlice.imageSuffix, "\" width=\"",
- curSlice.width,"\" height=\"", curSlice.height, "\" border=\"0\"");
-
- // Close layer div tag.
- WRITE_HTML("></div>\n");
- curZ++;
- }
-
- }
- }
-
- WRITE_HTML("\n");
- // Write comment for end of code copy/paste section.
- WRITE_HTML("<! ------------------------ STOP COPYING THE CODE HERE -------------------------->\n");
- WRITE_HTML("\n");
-
- WRITE_HTML("</body>\n")
- WRITE_HTML("\n")
-
- WRITE_HTML("</html>\n")
- WRITE_HTML("\n")
-
-